package com.wuye.repository;

import com.wuye.model.OrderItem;
import com.wuye.model.customer.OptionDetail;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by zhanchi on 2016/6/29.
 */
public interface OptionDetailRepository extends JpaRepository<OptionDetail, String> {

    @Query(nativeQuery = true,value="select wp.wuye_optionPoll_id,wp.wuye_optionPoll_name,date_format(wp.wuye_optionPoll_createTime,'%Y-%m-%d'),wo.wuye_optionDetail_id,"+
                                    "wo.wuye_optionDetail_name,wo.wuye_optionDetail_parentId,wo.wuye_optionDetail_parentName," +
                                    "wo.wuye_optionDetail_opName1,wo.wuye_optionDetail_opName2,wo.wuye_optionDetail_opName3,wo.wuye_optionDetail_opName4," +
                                     "wo.wuye_optionDetail_opName5,wo.wuye_optionDetail_opName6,wo.wuye_optionDetail_opName7,wo.wuye_optionDetail_opName8 "+
                                    "from wuye_optionPoll wp left join wuye_optionDetail wo on wp.wuye_OptionPoll_id = wo.wuye_optionDetail_pollId " +
                                    "where wp.wuye_optionPoll_id = ?1")
    public List<Object[]> findFields(String pollId);



}
